import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

/**
 * @author Juve
 *
 */
public class MOTtableTest {
	
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		MOTtable.startMOTtable();
	}
	
	/**
	 * Module Name:testReturnBinaryForMnemonic
	 * Description: this method is asserting a positive test result
	 * Calling Sequence
	 * 		Input Parameters File file, String instruction
	 * 		Output Parameters String test
	 * Error Conditions Tested: 
	 * Error Messages Generated:
	 * Original Author: Jaron 
	 * Procedure Creation Date: 
	 * Modification Log:
	 * 	 Who/When/Why
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	@Test
	public void testReturnBinaryForMnemonic() {
		String instruction = "LD-AC";
		String test = MOTtable.returnBinaryForMnemonic(instruction);
		assertEquals("Should be equal", "000000", test);
	}
	
	/**
	 * Module Name: testReturnHexForMnemonic
	 * Description: method that is asserting a positive test result
	 * Calling Sequence
	 * 		Input Parameters
	 * 		Output Parameters
	 * Error Conditions Tested:
	 * Error Messages Generated:
	 * Original Author:
	 * Procedure Creation Date:
	 * Modification Log:
	 * 	 Who/When/Why
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	@Test
	public void testReturnHexForMnemonic() {
		String instruction = "LD-BR";
		String test = MOTtable.returnHexForMnemonic(instruction);
		assertEquals("Should be equal", "6", test);
	}

	/**
	 * Module Name: testReturnOperandForMnemonic
	 * Description: method that is asserting a positive test result
	 * Calling Sequence
	 * 		Input Parameters
	 * 		Output Parameters
	 * Error Conditions Tested:
	 * Error Messages Generated:
	 * Original Author:
	 * Procedure Creation Date:
	 * Modification Log:
	 * 	 Who/When/Why
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	@Test
	public void testReturnOperandForMnemonic() {
		String instruction = "sra-Ac";
		String test = MOTtable.returnOperandForMnemonic(instruction);
		assertEquals("Should be equal", "type 4", test);
	}

	/**
	 * Module Name: testReturnDescriptionForMnemonic
	 * Description: method that is asserting a positive test result
	 * Calling Sequence
	 * 		Input Parameters
	 * 		Output Parameters
	 * Error Conditions Tested:
	 * Error Messages Generated:
	 * Original Author:
	 * Procedure Creation Date:
	 * Modification Log:
	 * 	 Who/When/Why
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	@Test
	public void testReturnDescriptionForMnemonic() {
		String instruction = "LD-BR-ADR";
		String test = MOTtable.returnDescriptionForMnemonic(instruction);
		assertEquals("Should be equal", "Load BR with address", test);
	}

	/**
	 * Module Name: testReturnActionForMnemonic
	 * Description: method that is asserting a positive test result
	 * Calling Sequence
	 * 		Input Parameters
	 * 		Output Parameters
	 * Error Conditions Tested:
	 * Error Messages Generated:
	 * Original Author:
	 * Procedure Creation Date:
	 * Modification Log:
	 * 	 Who/When/Why
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	@Test
	public void testReturnActionForMnemonic() {
		String instruction = "LD-PR";
		String test = MOTtable.returnActionForMnemonic(instruction);
		assertEquals("should be equal", "c(PR)=c(memory(effadd))", test );
	}

	/**
	 * Module Name: testMnemonicIsDefinedA
	 * Description: method that is asserting a positive test result
	 * Calling Sequence
	 * 		Input Parameters
	 * 		Output Parameters
	 * Error Conditions Tested:
	 * Error Messages Generated:
	 * Original Author:
	 * Procedure Creation Date:
	 * Modification Log:
	 * 	 Who/When/Why
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	@Test
	public void testMnemonicIsDefinedA() {
		String instruction = "st-ac";
		boolean test = MOTtable.mnemonicIsDefined(instruction);
		assertEquals("Should be true", true, test);
	}
	
	/**
	 * Module Name: testMnemonicIsDefinedB
	 * Description: method that is asserting a positive test result
	 * Calling Sequence
	 * 		Input Parameters
	 * 		Output Parameters
	 * Error Conditions Tested:
	 * Error Messages Generated:
	 * Original Author:
	 * Procedure Creation Date:
	 * Modification Log:
	 * 	 Who/When/Why
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	@Test
	public void testMnemonicIsDefinedB() {
		String instruction = "st-bra";
		boolean test = MOTtable.mnemonicIsDefined(instruction);
		assertEquals("Should be false", false, test);
	}
}
